﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace StaffModule.Utils {
    //添加用户信息校验
    public static  class RulesClass {
        //生成唯一员工id
        public static string GenerateEmployeeId() {
            string result = "";
            Guid uniqueId = Guid.NewGuid();
            result = uniqueId.ToString();
            result = result.Replace("-", "");
            return result;
        }
        /// <summary>
        /// 验证电话号码
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public static bool IsTel(string telephoneNumber) {
            return System.Text.RegularExpressions.Regex.IsMatch(telephoneNumber, @"^(\d{3,4}-)?\d{6,8}$");
        }

        /// <summary>
        /// 验证手机号码
        /// </summary>
        /// <param name="str_handset"></param>
        /// <returns></returns>
        public static bool IsMobile(string mobile) {
            if (string.IsNullOrEmpty(mobile))
                return false;
            return Regex.IsMatch(mobile, @"^(1)\d{10}$");
        }

        /// <summary>
        /// 验证输入为数字
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public static bool IsNumber(string str_number) {
            return System.Text.RegularExpressions.Regex.IsMatch(str_number, @"^[0-9]*$");
        }


    }
}
